package com.example.wallet.utils

import com.alibaba.fastjson.JSON
import com.example.wallet.bean.UserInfoTemple
import com.example.wallet.bean.UserInfoWrapper
import com.example.wallet.db.UserInfoManager

object UserInfoTempleHolder {

   private var userInfoTemple: UserInfoTemple?=null

    fun getUserInfoTemple():UserInfoTemple?{
        if (userInfoTemple!=null){
            return userInfoTemple
        }
        upDataUserInfoTemple()
        return userInfoTemple
    }

    fun upDataUserInfoTemple(){

        val userInfoTempleStr =
            UserInfoManager.userInfoManager.getUserInfoWrapper()?.userInfo?.UserInfoTemple
        if (userInfoTempleStr?.isNotEmpty()==true){
            userInfoTemple=JSON.parseObject(userInfoTempleStr,UserInfoTemple::class.java)
        }

    }

}